/*
 *  ConcreteNote.cpp
 *  SoundController0002
 *
 *  Created by jiro on 11/10/04.
 *  Copyright 2011 jiro music. All rights reserved.
 *
 */

#include "ConcreteNote.h"

using namespace ::sc::hs;

namespace sc
{
namespace system0039
{

	ConcreteNote::ConcreteNote()
		: Howl()
	{}
	
	ConcreteNote::ConcreteNote( 
			::sc::hs::Sound::WaveType waveType1, ::sc::Note::MidiNumber midiNumber1, double nthHarmonics1, double dynamics1,
			::sc::hs::Sound::WaveType waveType2, ::sc::Note::MidiNumber midiNumber2, double nthHarmonics2, double dynamics2 )
		: Howl( waveType1, waveType2, midiNumber1, midiNumber2, nthHarmonics1, nthHarmonics2, dynamics1, dynamics2 )
	{}

	ConcreteNote::ConcreteNote( 
			::sc::hs::Sound::WaveType waveType, double dynamics,
			::sc::Note::MidiNumber midiNumber1, double nthHarmonics1, 
			::sc::Note::MidiNumber midiNumber2, double nthHarmonics2 )
		: Howl( waveType, waveType, midiNumber1, midiNumber2, nthHarmonics1, nthHarmonics2, dynamics, dynamics )
	{}

	ConcreteNote::ConcreteNote( double freqency1, double dynamics1, double freqency2, double dynamics2 )
		: Howl( freqency1, freqency2, dynamics1, dynamics2 )
	{}


	bool ConcreteNote::operator == ( const ConcreteNote& rhs ) const
	{
		return Howl::operator == ( rhs );
	}

	bool ConcreteNote::operator != ( const ConcreteNote& rhs ) const
	{
		return not ( *this == rhs );
	}

	bool ConcreteNote::operator < ( const ConcreteNote& rhs ) const
	{
		if ( GetHarmonicSound( 0 ) != rhs.GetHarmonicSound( 0 ) )
		{
			return GetHarmonicSound( 0 ) < rhs.GetHarmonicSound( 0 );
		}
		if ( GetHarmonicSound( 0 ) != rhs.GetHarmonicSound( 1 ) )
		{
			return GetHarmonicSound( 0 ) < rhs.GetHarmonicSound( 1 );
		}
		if ( GetHarmonicSound( 1 ) != rhs.GetHarmonicSound( 0 ) )
		{
			return GetHarmonicSound( 1 ) < rhs.GetHarmonicSound( 0 );
		}
		if ( GetHarmonicSound( 1 ) != rhs.GetHarmonicSound( 1 ) )
		{
			return GetHarmonicSound( 1 ) < rhs.GetHarmonicSound( 1 );
		}
		return false;
	}

	void ConcreteNote::ToSoundElements( 
		std::vector< const ::sc::SoundElement32* >& note0,
		std::vector< const ::sc::SoundElement32* >& note1 ) const
	{
		double duration = GetDuration();
		note0 = HarmonicSystem::SoundToSoundElements( GetHarmonicSound( 0 ), duration );
		note1 = HarmonicSystem::SoundToSoundElements( GetHarmonicSound( 1 ), duration );
	}

	std::string ConcreteNote::ToString( int tabCount ) const
	{
		return Howl::ToString( tabCount );
	}

}
}
